package code.rocky.chapter01;


public class Suggest6 {

    public static void main(String[] args) {
        // 向上转型
        Base base = new Sub();
        base.fun(100, 50);
        // 不转型
        Sub sub = new Sub();
//        sub.fun(100, 50);
    }

    // 基类
    static class Base {
        void fun(int price, int... discounts) {
            System.out.println("Base.....fun");
        }
    }

    // 子类, 覆写父类方法
    static class Sub extends Base {

        @Override
        void fun(int price, int[] discounts) {
            System.out.println("Sub....fun");
        }
    }


}


